package com.company;

import java.util.Scanner;

public class six {
    public static void main(String[] args) {
        System.out.println("请输入一个数：");
        Scanner reader = new Scanner(System.in);
        String str = reader.next();
        System.out.println(r(str));
    }

    static boolean r(String str) {
        for (int i = 0; i < str.length() - i - 1; i++)//str为要判断的字符串
        {
            if (str.charAt(i) == str.charAt(str.length() - i - 1)) {
                continue;
            } else {
                System.out.println("不是回文数");
                return false;
            }
        }
        System.out.println("是回文数");
        return true;
    }
}

